package com.cby.jetpack.sample.paging3.data.api

import com.cby.jetpack.sample.paging3.bean.GankApiResponse
import com.cby.jetpack.sample.paging3.bean.GankGirlBean
import com.cby.jetpack.sample.paging3.data.RetrofitManager
import retrofit2.http.GET
import retrofit2.http.Path

/**
 * @description: GankApi
 *
 * @author ChenBaoyang
 * @date 8/12/21 11:20
 */
interface GankApi {

    /**
     * 获取Gank API的妹子图片信息列表
     * 路径地址：https://gank.io/api/v2/data/category/Girl/type/Girl/page/1/count/10
     *
     * @param page Int 页码
     */
    @GET("/api/v2/data/category/Girl/type/Girl/page/{page}/count/10")
    suspend fun loadGankGirlList(@Path("page") page: Int) : GankApiResponse<List<GankGirlBean>>?

    companion object{
        private const val BASE_URL = "https://gank.io"
        /**
         * GanK 开放API 接口
         *
         * @param service Class<T>
         * @return T
         */
        fun <T> getGankService(service: Class<T>): T =
            RetrofitManager.getService(service, BASE_URL)
    }

}